#ifndef TGRAPH_H
#define TGRAPH_H

#define NULL 0

class TGraph
{
	void destroy();
	void init(int _n);
	int n;
	int* adjacencyMatrix;
public:
	int N () {return n;}
	void fillAdjMatrix (int * d);
	
	void readFromAdjMatrix(const char* f);
	void readFromEdgeList(const char* file/*, int maxN*/);

	int operator() (int x, int y) const  {return adjacencyMatrix[x*n+y];}
	TGraph() {adjacencyMatrix=NULL;}
	~TGraph() {destroy();}
};

#endif